# 导入依赖库

from dotenv import load_dotenv, find_dotenv
import openai
import os
# 加载 .env 文件中定义的环境变量
_ = load_dotenv(find_dotenv())

# 初始化 OpenAI 客户端

openai.api_key=os.environ["OPENAI_API_KEY_ZHIHU"]
openai.api_base=os.environ["OPENAI_API_BASE_ZHIHU"]

# openai.api_key = os.environ["OPENAI_API_KEY_ZHIHU2"]
# openai.api_base = os.environ["OPENAI_API_BASE_ZHIHU"]

model = "gpt-3.5-turbo"
messages = [{
    "role":"user","content":"我应该如何学习AI"
}]

response = openai.ChatCompletion.create(model=model,messages=messages,temperature=0)
print(response.choices[0].message.content)